package com.dousb.oj.judge.codesandbox;


import com.dousb.oj.exception.BusinessException;
import com.dousb.oj.judge.codesandbox.model.ExecuteCodeRequest;
import com.dousb.oj.judge.codesandbox.model.ExecuteCodeResponse;
import lombok.extern.slf4j.Slf4j;

/**
 * CodeSandboxProxy
 *
 * @author 豆沙包
 * @version 1.0
 * @since 2025-11-01  15:24
 */
@Slf4j
public class CodeSandboxProxy implements CodeSandbox {

    private final CodeSandbox codeSandbox;

    public CodeSandboxProxy(CodeSandbox codeSandbox) {
        this.codeSandbox = codeSandbox;
    }

    /**
     * 执行代码
     *
     * @param request 请求参数
     * @return 执行结果
     */
    @Override
    public ExecuteCodeResponse executeCode(ExecuteCodeRequest request) {
        log.info("代码沙箱请求信息：{}", request.toString());
        ExecuteCodeResponse executeCodeResponse = codeSandbox.executeCode(request);
        log.info("代码沙箱响应信息：{}", executeCodeResponse.toString());
        return executeCodeResponse;
    }
}